home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 2 / Gold Medal Software Volume 2 (Gold Medal) (1994).iso / os2 / zoc110.arj / ZOC / SCRIPT / SAMPLES / 3_META2 < prev    next >
Text File  |  1993-10-07  |  2KB  |  82 lines

  1. ////////////////////////////////////////////////////////
  2. // DEMONSTRATING MORE METAS
  3. // (simple ascii, simple numeric, indirect, arrays)
  4. ////////////////////////////////////////////////////////
  5.  
  6. // PART1 /// SIMPLE ASCII METAS ////////////////////////////
  7.  
  8. // create an ascii meta
  9. seta hello "Hello World!"
  10.  
  11. // Just print hello
  12. writeln "hello"
  13.  
  14. // Print value of meta 'hello'
  15. // (this is't an environment meta!)
  16. writeln "%hello%"
  17. writeln "Hi you! %hello%"
  18.  
  19. // convert to uppercase
  20. upper hello
  21.  
  22.  
  23. // PART2 /// SIMPLE NUMERIC METAS ///////////////////////////
  24.  
  25. // create a numeric meta
  26. setn num1 27
  27.  
  28. // do a little calculation
  29. sub num1 2
  30. div num1 5
  31. add num1 3
  32. mod num1 6
  33.  
  34. // show result
  35. writeln "OS/%num1%"
  36.  
  37. // PART3 /// INDIRECT METAS //////////////////////////////////////
  38.  
  39. // set up a normal meta
  40. seta first "HELLO"
  41.  
  42. // set up a meta that contains the value of another meta
  43. // second will contain the string '%first%'
  44. // third will contain the string 'HELLO'
  45. seta second "%%first%%"
  46. seta third  "%first%"
  47.  
  48. // change the value of first
  49. seta first "HI"
  50.  
  51. // third still contains HELLO, since it was assigned directly
  52. // second still contains %first% and evaluates to the current 
  53. // value of first
  54. writeln "first=%first%"
  55. writeln "second=%second%"
  56. writeln "third=%third%"
  57.  
  58.  
  59. // PART4 /// ARRAYS METAS /////////////////////////////////////////
  60. // set up a little "array"
  61. seta line1 "Thank"
  62. seta line2 "you"
  63. seta line3 "for"
  64. seta line4 "testing"
  65. seta line5 "Zap-O-Com"
  66.  
  67. // do a loop from 1 .. 5
  68. setn n 1
  69. :loop
  70.     // this will evauluate to %line1% (% line %n% %)
  71.     seta ind "%%line%n%%%"
  72.     write "%ind% "
  73.     inc n
  74.     compn "%n%" with 5
  75.     ifnhigh goto loop
  76.  
  77. writeln
  78.  
  79. // done it
  80. endscript
  81.  
  82.